//TOWN SCRIPT TEMPLATE

begintownscript;

variables;
short i, j, k, l, choice;

body;

beginstate INIT_STATE;
	set_crime_tolerance(1);

if (get_flag(5,0) == 0) {
	set_flag(5,0,1);
	force_instant_terrain_redraw();
	message_dialog("You enter what must surely be the Perilous Path that Narayan described. You have to admit, it is not exactly what you expected.","");
	play_sound(-161);
	}
break;

beginstate EXIT_STATE;
//called when the party leaves the town
	text_bubble_on_char(0,"");
	text_bubble_on_char(1,"");
	text_bubble_on_char(2,"");
	text_bubble_on_char(3,"");

break;

beginstate START_STATE;
//called every turn when the party is in the town
if (get_ran(1,0,100) < 3)
	text_bubble_on_char(1,"*grunt*");
if (get_ran(1,0,100) < 3)
	text_bubble_on_char(2,"Here, kitty kitty!");
if (get_ran(1,0,100) < 3)
	text_bubble_on_char(2,"Pretty flowers!");
if (get_ran(1,0,100) < 3)
	text_bubble_on_char(3,"*sigh*");

text_bubble_on_char(get_ran(1,6,25),"*meow*");
text_bubble_on_char(get_ran(1,6,25),"*meow*");
text_bubble_on_char(get_ran(1,6,25),"*meow*");
if (get_ran(1,0,100) < 7)
	text_bubble_on_char(get_ran(1,6,25),"*meow*");
if (get_ran(1,0,100) < 7)
	text_bubble_on_char(get_ran(1,6,25),"*meow*");
if (get_ran(1,0,10) < 4)
	play_sound(-161);
break;

beginstate 10;
if (get_flag(5,1) == 0) {
	
	while (i < 119) {
	if (char_ok(i))
		text_bubble_on_char(i,"");
	i = i + 1;
	}

	set_flag(5,1,1);
	block_entry(1);
	message_dialog("You stop for a moment.","");

	text_bubble_on_char(0,"THIS...");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(0,"");
	text_bubble_on_char(0,"is the Perilous Path?");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(0,"");
	text_bubble_on_char(0,"It's full of flowers and kittens!");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(0,"");
	text_bubble_on_char(2,"Maybe they're...");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(2,"");
	text_bubble_on_char(2,"KITTENS OF EVIL MAGIC");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(2,"");
	text_bubble_on_char(2,"or something.");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(2,"");
	text_bubble_on_char(3,"*snicker*");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(3,"");
	text_bubble_on_char(2,"Hey, it's possible!!");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(2,"");
	text_bubble_on_char(2,"They could attack us");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(2,"");
	text_bubble_on_char(2,"any second now....");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(2,"");
	force_instant_terrain_redraw();
	pause(10 * get_flag(290,0));

	text_bubble_on_char(2,"");
	text_bubble_on_char(2,"Any second now.");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(2,"");
	force_instant_terrain_redraw();
	}

break;

beginstate 11;
if (get_flag(5,2) == 0) {
	
	while (i < 119) {
	if (char_ok(i))
		text_bubble_on_char(i,"");
	i = i + 1;
	}

	set_flag(5,2,1);
	block_entry(1);
	message_dialog("You stop for a moment again.","");

	text_bubble_on_char(0,"I have a theory.");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(0,"");
	text_bubble_on_char(3,"*groan*");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(3,"");
	text_bubble_on_char(3,"Helmet-brain has a theory.");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(3,"");
	force_instant_terrain_redraw();

	message_dialog("Ignoring your less-than-encouraging companion, you continue. _I think that the Perilous Path is not so much a descriptive name as it is clever marketing. See, if people think it's perilous, they won't go down the path._","You add, _It guards the way just as well as if they had big traps and guards, without the expense of actually having traps and guards._");

	text_bubble_on_char(0,"");
	text_bubble_on_char(0,"See?");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(0,"");
	text_bubble_on_char(0,"Just marketing.");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(0,"");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(1,"*grunt*");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(1,"");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(0,"No one appreciates me.");
	force_instant_terrain_redraw();
	pause(5 * get_flag(290,0));

	text_bubble_on_char(0,"");
	force_instant_terrain_redraw();
	}

break;